<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>订单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript" src="${ctxScript}/menu/menuGoods3.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		//$("#name").focus();
		$("#inputForm").validate({
			submitHandler: function(form){
				loading('正在提交，请稍等...');
				form.submit();
			},
			errorContainer: "#messageBox",
			errorPlacement: function(error, element) {
				$("#messageBox").text("输入有误，请先更正。");
				if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
					error.appendTo(element.parent().parent());
				} else {
					error.insertAfter(element);
				}
			}
		});
	});

	function addOrderGoods(){
		var table = document.getElementById('contentTable');

	}

	function removeOrderGoods(){
	var table = document.getElementById('contentTable');

	}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/menu/order3/">订单列表</a></li>
		<li class="active"><a href="${ctx}/menu/order3/form?id=${order3.id}">订单<shiro:hasPermission name="menu:order3:edit">${not empty order3.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="menu:order3:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="order3" action="${ctx}/menu/order3/save" method="post" class="form-horizontal">
			<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">订单状态：</label>
			<div class="controls">
				<form:input path="orderStatus" htmlEscape="false" maxlength="100" class="input-xlarge "/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">收件人：</label>
			<div class="controls">
				<form:input path="consignee" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">收件地址：</label>
			<div class="controls">
				<form:input path="address" htmlEscape="false" maxlength="100" class="input-xlarge required"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">手机号：</label>
			<div class="controls">
				<form:input path="phone" htmlEscape="false" maxlength="20" class="input-xlarge required digits"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">付款总额：</label>
			<div class="controls">
				<form:input path="moneyPaid" htmlEscape="false" class="input-xlarge required"/>

			</div>
		</div>
		<div class="control-group">
			<label class="control-label">描述：</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="20" class="input-xxlarge "/>
			</div>
		</div>



		<table id="contentTable" class="table table-striped table-bordered table-condensed">
			<thead>
				<tr>
				<th>序号</th>
				<th>商品名称</th>
				<th>商品单价</th>
				<th>商品数量</th>
				<th><a href="javascript:rowAdd()">新增商品</a></th>
				</tr>
			</thead>
			<tbody>

			<c:forEach items="${orderGoodsList}" var="orderGoods3" varStatus="vs">
				<tr>
				<td>${vs.index+1}</td>
				<input type="hidden" name="orderGoodsList[${vs.index}].id" class="per-id" value="${orderGoods3.id}"/>
				<td><input type="text" name="orderGoodsList[${vs.index}].name" class="input-xlarge per-name"value="${orderGoods3.name}"/></td>
				<td><input type="text" name="orderGoodsList[${vs.index}].price" class="input-xlarge per-price"value="${orderGoods3.price}"/></td>
				<td><input type="text" name="orderGoodsList[${vs.index}].stock" class="input-xlarge per-stock" value="${orderGoods3.stock}"/></td>
				<td><a href="javascript:;" onclick="rowDelete(this)">删除</a></td>
				</tr>
			</c:forEach>
			</tbody>
		</table>

		<div class="form-actions">
			<shiro:hasPermission name="menu:order3:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>